package com.fusion.core.crypto.cryptolayers;

import com.fusion.core.CoreSubsystem;
import com.fusion.core.comm.Connection;

import java.io.IOException;
import java.nio.ByteBuffer;

/**
 *
 * Simple encryption layer used for testing
 *
 * @author SwethaShivakumar 
 * Project: fusion
 * Date: Mar 11, 2009
 * URL: http://fusionwiki.co.cc
 * Mail Me At: shiva@fusionproject.co.cc
 */
public class NoEncryptionCryptoLayer extends BufferedCryptoLayer {
    public NoEncryptionCryptoLayer(CoreSubsystem core) {
        super(core);
    }

    public void closed(Connection c) {
    }

    public int encrypt(Connection c, ByteBuffer src, ByteBuffer dst) throws IOException {
        int r = src.remaining();
        dst.put(src);
        return r;
    }

    public void decrypt(Connection c, ByteBuffer src, ByteBuffer dst) throws IOException {
        dst.put(src);
    }
}
